from flask_sqlalchemy import SQLAlchemy
from App.ext import models

# 作者模型
class Author(models.Model):
    # __tablename__ = 'authors'
    id = models.Column(models.Integer, primary_key=True)
    name = models.Column(models.String(64), unique=True)

# 书籍模型
class Book(models.Model):
    # __tablename__ = 'books'
    id = models.Column(models.Integer, primary_key=True)
    name = models.Column(models.String(16), unique=True)
    author_id = models.Column(models.Integer, models.ForeignKey(Author.id))

